﻿using System;
using System.Diagnostics.Contracts;

namespace CardPlay.Model.CardModel
{
    [ContractClass(typeof(CodeContractForIDealContext))]
    public interface IDealContext
    {
        bool IsDeckEmpty { get; }

        uint Step { get; }
    
        void DealCard(Predicate<CardFace> cardSelector, CardOrientation orientation, string toPile);
        void DealCard(Predicate<CardFace> cardSelector, CardOrientation orientation, Func<Card, string> targetSelector);
    }

    [ContractClassFor(typeof(IDealContext))]
    internal abstract class CodeContractForIDealContext : IDealContext
    {
        public uint Step
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsDeckEmpty
        {
            get { throw new NotImplementedException(); }
        }

        public void DealCard(Predicate<CardFace> cardSelector, CardOrientation orientation, string toPile)
        {
            Contract.Requires<ArgumentNullException>(cardSelector != null);
            Contract.Requires<ArgumentNullException>(toPile != null);
        }

        public void DealCard(Predicate<CardFace> cardSelector, CardOrientation orientation, Func<Card, string> targetSelector)
        {
            Contract.Requires<ArgumentNullException>(cardSelector != null);
            Contract.Requires<ArgumentNullException>(targetSelector != null);
        }
    }
}
